/*
 * driverDesti.java
 *
 * Created on May 24, 2005, 12:41 PM
 */

package aa.drivers;

import aa.core.*;
import aa.gui.View;
import aa.tool.CyberOrgTuple;

import java.net.InetAddress;
import java.util.LinkedList;
import java.util.Hashtable;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author  xinghuizhao
 */
public class driverDesti {
    
    /** Creates a new instance of driverDesti */
    public driverDesti() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws InterruptedException {
        // TODO code application logic here
        
        Integer iPort = new Integer(8070);
        
        View myView = new View(iPort);
        
        Platform myPlatform = new Platform(myView,iPort);
        
        myPlatform.start();
        try{
        Thread.sleep(100);
        } catch(InterruptedException ie){
            ie.printStackTrace();
        }
        Object[] objaAgs = new Object[0];
        Object[] objaFaci = {new Long(0)};
       
        CyberOrg cyb = (CyberOrg)myPlatform.createCyberOrg(new Long(90000000),new Long(90000),new Long(1000),"aa.drivers.FaciPara",objaFaci);
        ActorName CDM = myPlatform.createActor(cyb.getFacilitator(),"aa.app.dm.CyberOrgDirectoryManager", objaAgs);
        ActorName GDM = myPlatform.createActor(cyb.getFacilitator(),"aa.app.dm.GameDirectoryManager", objaAgs);
        ActorName broker = myPlatform.createActor(cyb.getFacilitator(),"com.agentslab.Broker.Broker", objaAgs);
        ActorName an = myPlatform.createActor(cyb.getFacilitator(),"aa.core.Actor", objaAgs);
        CyberOrgTuple cyberOrgTuple=new CyberOrgTuple(myPlatform.getActorNameOfPlatform().getHostAddress(), 2, "aa.drivers.FaciPara", cyb.getContract());
        Object[] argsreg=new Object[1];
        argsreg[0]=cyberOrgTuple;


        ActorMessage am_reg = new ActorMessage(myPlatform.getActorNameOfPlatform(),
                                               broker,
                                               "registerToCDM",
                                               argsreg,
                                               false
                                               );

        myPlatform.sendMessage(am_reg);
        
    }
    
}
